<template>
	<view class="content">
		
		 <view class="nonebox flexBox flexCenter flexWap" v-show="showNone==false">
			<image class="icon" src="/pages_mine/pages/static/addr/none.png" mode=""></image>
			<view class="title">暂未设置</view>
			<view class="des">没有收货地址寄不了快递哦~</view>
			<view class="btnAdd" @tap="ToNewAddr">新增地址</view>
		 </view>
		 
		<view class="rowsList" v-for="(item,index) in addrList" :key="index">
			<view class="beThis fontSize12" v-show="item.beThis">默认</view>
			<view class="detailsAddr overflow_one">{{item.addr}}</view>
			<view class="clearBoth"></view>
			<view class="name fontSize13">{{item.name}}</view>
			<view class="tel fontSize13">{{item.tel}}</view>
			<image class="btnEdit" src="/pages_mine/pages/static/addr/icon_1.png" mode="" @tap="btnEdit(item.id)"></image>
			<view class="clearBoth"></view>
		</view>
		
		<view class="addrBtn" @tap="ToNewAddr" v-show="showNone==true">新增地址</view>
		
	</view>
</template>
<style>
	.content{padding-bottom: 150upx;min-height: 100vh;background: white;padding-top: 2upx;}
	.content .nonebox{width: 100%;margin-top: 100upx;}
	.content .nonebox .icon{width: 400upx;height:260upx;margin:0 200upx}
	.content .nonebox .title{width: 100%;text-align: center;font-size: 32upx;color:#262626;font-weight: bold;margin-top: 20upx;}
	.content .nonebox .des{width: 100%;text-align: center;font-size: 28upx;color:#B3B3B3;margin:10upx 0 20upx 0}
	.content .nonebox .btnAdd{padding:10upx 40upx;border-radius: 100upx;color:white;background:#DC582A;font-weight: bold;}
	.content .rowsList{width: 100%;padding:20upx 5%;position: relative;background: white;margin-top: 20upx;}
	.content .rowsList .beThis{padding:4upx 10upx;margin-right: 5%;font-weight: bold;color:#DC582A;background: rgb(251,238,233);border-radius: 6upx;float: left;}
	.content .rowsList .detailsAddr{max-width: 75%;font-weight: bold;font-size: 32upx;float: left;}
	.content .rowsList .name,
	.content .rowsList .tel{color:#262626;float: left;;margin-right:5%;margin-top: 20upx;}
	.content .rowsList .btnEdit{width: 28upx;height:30upx;position: absolute;top:40%;right:5%;z-index: 2;}
	.content .addrBtn{width: 90%;margin-left: 0%;padding:20upx 0;background: #DC582A;color:white;font-size: 32upx;text-align: center;border-radius: 100upx;position: fixed;left:5%;bottom:20upx;z-index: 3;}
</style>
<script>
	import Share from '@/common/wx_share.js'
	export default {
		data() {
			return {
				share:{
					title:"",
					path:'/pages/tabbar/index',
					imageUrl:'',
					desc:'',
					content:''
				},
				addrList:[
					// {id:1,beThis:true,addr:"这是地方1",name:"名字",tel:123123213213},
					// {id:1,beThis:false,addr:"这是地方2",name:"名字",tel:123123213213},
				],
				pages:1,
				showNone:null,

				
			}
		},
		onShow(){
			this.pages = 1
			this.addrList = []
			this.AjaxLoad()
		},
		onReachBottom(){
			this.pages++
			this.AjaxLoad()
		},
		methods: {
			AjaxLoad(){
				var addrList = []
				let param={
					token:this._$userToken("userInfo").token,
					page:this.pages
				};
				this._$InitRequest.request("Address/index", param).then(res => {
					res.data.forEach( (item) =>{
						let beThis = false
						if( item.moren == 1 )beThis = true
						addrList.push({
							id:item.id,
							addr:item.pro_name + item.city_name + item.area_name + item.address,
							name:item.contacts,
							tel:item.phone,
							beThis:beThis,
						})
					})
					for (var i = 0; i < addrList.length; i++){this.addrList.push( addrList[i] )}
					if( this.addrList.length !== 0 ){
						this.showNone = true
					}else{
						this.showNone = false
					}
					
				},error=>{})
			},
			ToNewAddr(){
				uni.navigateTo({
					url:"/pages_mine/pages/edit_add_addr/edit_add_addr"
				})
			},
			btnEdit(id){
				uni.navigateTo({
					url:"/pages_mine/pages/edit_add_addr/edit_add_addr?id=" + id
				})
			},
			
			
			
			
			
		}
	}
</script>
<style lang="scss" scoped>
/deep/ .uni-input-input {font-size:32upx}
/deep/ .uni-radio-input-checked{background-color:rgb(110,43,34) !important;border:2upx solid white !important}
.content .html{
  ::v-deep {
    img {
      width: 100%;
    }
  }
}
</style>